package com.sisyphus.mock.data;

import com.sisyphus.mock.data.entities.UserEntity;

import java.util.List;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;
import androidx.room.Update;

@Dao
public interface UserMapper {

    @Insert
    void insertUser(UserEntity user);

    @Update
    void updateUser(UserEntity user);

    @Query("SELECT * FROM users WHERE id = :id LIMIT 1")
    UserEntity findById(Long id);

    //    @Query("SELECT * FROM users WHERE email IN (:email) LIMIT 1")
    @Query("SELECT * FROM users WHERE email = :email LIMIT 1")
    UserEntity findByEmail(String email);

    @Query("SELECT * FROM users WHERE token = :token LIMIT 1")
    UserEntity findByToken(String token);

    @Query("SELECT * FROM users WHERE email = :email AND password = :password LIMIT 1")
    UserEntity findByEmail(String email, String password);

}
